//
//  SideMenuView.swift
//  JiaoZiTaxi
//
//  Created by Hu Gang on 2022/10/17.
//

import SwiftUI

struct SideMenuView: View {
    @Binding var showSelf  : Bool
    @Binding var showSheet : Bool
    @Binding var showDebug : Bool
    @Binding var showLog : Bool
    @Binding var showAbout : Bool
    @Binding var showOrders : Bool
    
    var body: some View {
        
        VStack(alignment: .leading) {
            HStack {
                Image("home_me")
                    .resizable()
                    .frame(width: 60, height: 60)
                Text("轿子出行")
                    .font(.system(size: 20))
                    .foregroundColor(Color(hex: "#85308D"))
            }.padding(.top, 95)
            
            VStack(alignment: .leading, content: {
                Button {
                    showSelf.toggle()
                    showSheet.toggle()
                } label: {
                    HStack {
                        Image(systemName: "person")
                            .foregroundColor(.black)
                            .imageScale(.large)
                        
                        Text("乘客信息")
                            .foregroundColor(.black)
                            .font(.headline)
                    }
                }
                
                //            Button {
                //                showOrders.toggle()
                //            } label: {
                //                HStack {
                //                    Image(systemName: "list.bullet.circle")
                //                        .foregroundColor(.gray)
                //                        .imageScale(.large)
                //
                //                    Text("订单历史")
                //                        .foregroundColor(.gray)
                //                        .font(.headline)
                //                }.padding(.top,30)
                //            }
                
                NavigationLink(destination: OrdersView()) {
                    HStack {
                        Image(systemName: "list.bullet.circle")
                            .foregroundColor(.black)
                            .imageScale(.large)
                        
                        Text("订单历史")
                            .foregroundColor(.black)
                            .font(.headline)
                    }.padding(.top, 15)
                }.navigationTitle("轿子出行")
                
                if !ViewModel.shared.releaseMode {
                    Button {
                        showSelf.toggle()
                        showDebug.toggle()
                    } label: {
                        HStack {
                            Image(systemName: "list.bullet.clipboard")
                                .foregroundColor(.black)
                                .imageScale(.large)
                            
                            Text("调试信息")
                                .foregroundColor(.black)
                                .font(.headline)
                        }.padding(.top,15)
                    }
                }
                
#if DEBUG
                NavigationLink(destination: LogView()) {
                    HStack {
                        Image(systemName: "list.bullet.rectangle")
                            .foregroundColor(.black)
                            .imageScale(.large)
                        
                        Text("日志查看")
                            .foregroundColor(.black)
                            .font(.headline)
                    }.padding(.top,15)
                }
#endif
                Button {
                    print("about us")
                    showAbout.toggle()
                } label: {
                    Image(systemName: "info.circle.fill")
                        .foregroundColor(.black)
                        .imageScale(.large)
                    
                    Text("关于我们")
                        .foregroundColor(.black)
                        .font(.headline)
                }.padding(.top,15)
            })
            .padding(.top, 40)
            .padding(.leading, 20)
            .foregroundColor(.black)
            Spacer()
        }.padding()
         .frame(maxWidth: .infinity)
         .background(.white)
         .ignoresSafeArea(.all)
    }
}

struct SideMenuView_Previews: PreviewProvider {
    static var previews: some View {
        SideMenuView(showSelf: .constant(true), showSheet: .constant(true),showDebug: .constant(false),showLog: .constant(true), showAbout: .constant(false),showOrders: .constant(false))
    }
}
